package org.example.frw.mybatisplus.generator;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import org.example.api.marker.controller.UidControllerFeign;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * @author rui.hou
 */
@Component
public class MarkerIdGenerator implements IdentifierGenerator {

    private final UidControllerFeign markerFeign;

  public MarkerIdGenerator(@Qualifier("org.example.api.marker.controller.UidControllerFeign") UidControllerFeign markerFeign) {
    this.markerFeign = markerFeign;
  }

  @Override
    public Number nextId(Object entity) {
        return markerFeign.getUid(1);
    }

}